import { plugin, Messagetype } from 'alemon'
import { obtainingImages } from '../../lib/img/index.js'
import menu from '../../lib/menu.js'
import { join } from 'node:path'
import { MyDirPath } from '../../app.config.js'

export class K_菜单 extends plugin {
  constructor() {
    super({
      dsc: '菜单',
      rule: [
        {
          reg: '^/(空空|kk)(帮助|help|菜单)',
          fnc: '菜单'
        }
      ]
    })
  }
  async 菜单(e: Messagetype): Promise<boolean> {
    const data = {
      floor: Math.floor,
      path: join(MyDirPath, '/resources').replace(/\\/g, '/'),
      menu
    }
    const img = await obtainingImages('', '菜单', data)

    if (img) e.postImage(img)
    return true
  }
}
